import Api from '@/api/finance/transactions'
import i18n from "@/lang/index";
import ExportsApi from '@/api/system/exports'
const contentConfig = {
  pageName: "sys:user",
  table: {
    border: true,
    highlightCurrentRow: false,
  },
  indexAction: (data) => {
    console.log("index", data);
    return new Promise((resolve, reject) => {
      Api.getList(data).then(s => {
        console.log(s);
        resolve(s)
      }).catch(e => {
        console.log(e);
        reject(e)
      })
    });
  },
  deleteAction: function (id) {
    console.log("delete", id);
    return new Promise((resolve, reject) => {
      resolve(true)
    });
  },
  exportAction: function (queryParams) {
    return new Promise((resolve, reject) => {
      ExportsApi.add({ ...queryParams, ...{ type: 'transaction' } }).then(s => {
        resolve({
          code: "00000",
          data: null,
          msg: i18n.global.t("hint.85"),
        })
      }).catch(e => {
        reject(e)
      })
    });
  },
  pk: "id",
  toolbar: [
    "refresh",
    // "add",
    // "delete",
    "export",
    // {
    //   name: "import",
    //   icon: "upload",
    //   text: "导入",
    //   auth: "import",
    // },
  ],
  cols: [
    { label: i18n.global.t("label.15"), align: "center", prop: "user_id", width: 150,fixed: "left" },
    { label: i18n.global.t("label.9"), align: "center", prop: "user.username", width: 150 ,fixed: "left"},
    { label: i18n.global.t("label.119"), align: "center", prop: "ulid", minWidth: 250,fixed: "left" },
    { label: i18n.global.t("label.11"), align: "center", prop: "amount" },
    { label: i18n.global.t("label.3"), align: "center", prop: "balance" },
    { label: i18n.global.t("label.12"), align: "center", prop: "currency_code", width: 150 },
    { label: i18n.global.t("label.18"), align: "center", prop: "type", templet: 'custom', },
    { label: i18n.global.t("label.14"), align: "center", prop: "note" ,minWidth: 180},
    { label: i18n.global.t("label.13"), align: "center", "type": "time", prop: "updated_at", minWidth: 180,fixed: "right" },
  ],
};

export default contentConfig;
